﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data;
using eDoc.DAL;
namespace eDocWS
{
    /// <summary>
    /// Summary description for Login
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class Login : System.Web.Services.WebService
    {

        [WebMethod(Description = "Thong tin dang nhap : -1: sai user;  0: thanh cong; 1: sai mat khau; 2: sai uidi;")]
        public string LoginApp(string U, string P, string Uidi, string PartnerCode)
        {
            string result = "-1";
            string strpassmd5 = Encryptor.GetMd5Hash(P);
            DataTable dt = new DataTable();
            using (MainDB db = new MainDB())
            {
                dt = db.StoredProcedures.VNA_Login_App(U, strpassmd5, Uidi, PartnerCode);
                db.Close();
            }

            if (dt != null && dt.Rows.Count > 0)
            {
                result = dt.Rows[0][0].ToString();
            }

            return result;
        }
    }
}
